package com.woniuxy.controller;

import com.woniuxy.service.RbacManagerService;
import com.woniuxy.pojo.RbacManager;
import com.woniuxy.pojo.ResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/rbacManager")
public class RbacManagerController {
    @Autowired
    RbacManagerService rbacManagerService;

    @PostMapping("/manager")
    public ResponseEntity addOne(@RequestBody RbacManager rbacManager) {
        return rbacManagerService.addOne(rbacManager);
    }

    @DeleteMapping("/manager/{id}")
    public ResponseEntity deleteOne(@PathVariable int id) {
        return rbacManagerService.deleteOne(id);
    }

    @RequestMapping("/manager")
    public ResponseEntity updataManager(@RequestBody RbacManager rbacManager) {
        return rbacManagerService.updateManager(rbacManager);
    }
    @GetMapping("/manager/{id}")
    public ResponseEntity findOne(@PathVariable int id){
        return rbacManagerService.findOne(id);
    }
    @GetMapping("/manager")
    public ResponseEntity findAll(){
        return rbacManagerService.findAll();
    }

}
